Skip to content

Conversation

@smans-akamai
Copy link
Contributor

@smans-akamai smans-akamai commented Jan 13, 2026

Description 📝

This pull request is to implement the Add Pool functionality for PgBouncer. This will allow users to create new connection pools via a new drawer. Those connection pools will then be added to the connection pools table in the Networking tab.

Changes 🔄

List any change(s) relevant to the reviewer.

  • Configures the Add Pool button in the Database Details Networking tab Manage PgBouncer Connection Pools section to open an add connection pool drawer.
  • Adds default values and validation for the fields in this drawer.

Scope 🚢

Upon production release, changes in this PR will be visible to:

  • All customers
  • Some customers (e.g. in Beta or Limited Availability)
  • No customers / Not applicable

Preview 📷

Before After
BEFORE-add-pool AFTER-add-pool

How to test 🧪

Prerequisites

(How to setup test environment)

  • Have the Database PgBouncer feature flag enabled
  • Turn on the legacy MSW
  • To make sure the Add Pool button gets enabled for postgresql database clusters, modify the mock database response by setting the database status property in makeMockDatabase to active.
  • To do this, add a new line here and add the following:
database.status = 'active';

Verification steps

(How to verify changes)
General

  • Go to the Networking tab of an active PostgreSQL Database Cluster http://localhost:3000/databases/postgresql/1/networking
  • Select the Add Pool button in the Manage PgBouncer Connection Pools section to open the Add a New Connection Pool drawer
  • Make a valid selection in the fields and select Add Pool
  • Verify that the connection pool is submitted successfully and that the drawer closes
  • Verify that reopening the drawer resets it to the default state

Backend Errors Displaying Below Fields

  • Uncomment the mock error response included in this pull request for the connection-pools POST request
  • Go to the Networking tab of an active PostgreSQL Database Cluster http://localhost:3000/databases/postgresql/1/networking
  • Select the Add Pool button in the Manage PgBouncer Connection Pools section to open the Add a New Connection Pool drawer
  • Make a valid selection in the fields and select Add Pool
  • Select submit and see that the POST returns an error response
  • Verify that the backend errors are displayed below their respective fields.
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All tests and CI checks are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@smans-akamai smans-akamai force-pushed the UIE-9379-dbaas-networking-pgbouncer-add-connection-pool branch from 3595b01 to eceb323 Compare January 15, 2026 20:37
@smans-akamai smans-akamai added the DBaaS Relates to Database as a Service label Jan 15, 2026
@smans-akamai smans-akamai marked this pull request as ready for review January 15, 2026 22:30
@smans-akamai smans-akamai requested a review from a team as a code owner January 15, 2026 22:30
border: `1px solid ${theme.tokens.component.Select.Error.Border}`,
}
: undefined;
};
Copy link
Contributor Author

@smans-akamai smans-akamai Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drawer is currently using the CDS Select and Linode MUI TextField since the numeric spinner isn't available in the cds-web-components yet. This is to give the cds Select component the same error border color that gets used with the Linode components in their error state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we can also provide an error class to select, so I'm going to look into whether that gives the same border color. If so, we may be able to remove this and leverage that instead.

Copy link
Contributor Author

@smans-akamai smans-akamai Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After testing it out, it looks like providing className="error" to the Select component doesn't provide the error class to the component and, as a result, it won't display the error styles for that class from the component. I also tried wrapping it in a div with the error class name, but that didn't work either.

Is there a specific way this class needs to be applied to Select? Otherwise we may need to keep this as a workaround for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure since it's a CDS Select and it's different from how our UI Select component works. Maybe the CDS team would know

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smans-akamai, your approach also seems fine.

I wasn't able to reproduce an error state for these selects since there are no empty options, but I was playing around with cds-web-components and also just adding a new select there:

you can add your className but you also need to use styled :

const StyledSelect = styled(Select)`
  &.your-class {
 ...
  }
`;

<StyledSelect
{...field}
className="your-class"
data-testid="database-name-select"
...
/>

Copy link
Contributor Author

@smans-akamai smans-akamai Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaleksee-akamai Thanks, I'll look into this other approach. In the meantime, you can reproduce the error state in this pull request with the following steps:

  • Uncomment the mock error response for the connection-pools POST request
  • Go to the Networking tab of an active PostgreSQL Database Cluster http://localhost:3000/databases/postgresql/1/networking
  • Select the Add Pool button in the Manage PgBouncer Connection Pools section to open the Add a New Connection Pool drawer
  • Make a valid selection in the fields and select Add Pool
  • Select submit and see that the POST returns an error response
  • Verify that the backend errors are displayed below their respective fields.

I've included the steps in the description.

// },
// { status: 400 }
// );
return HttpResponse.json(connectionPool);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can uncomment the lines above to mock the error response for the fields to see the inline errors.

@smans-akamai smans-akamai self-assigned this Jan 16, 2026
className={classes.actionBtn}
disabled={true}
onClick={() => null}
disabled={database.status !== 'active'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a tooltip to explain why the button is disabled. Something like:

Suggested change
disabled={database.status !== 'active'}
disabled={database.status !== 'active'}
tooltipText={
database.status !== 'active' ? 'Cluster must be active' : ''
}

Copy link
Contributor Author

@smans-akamai smans-akamai Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point! I've just made this change and included the following text:
To add a new connection pool, the database cluster must be active.

I used similar language to what we have for DatabaseManageNetworking but I can double check the language with tech writing.

Here's it appearing in the UI
add-pool-disabled-tooltip

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm what about The database cluster must be active to add a new connection pool? Swap the wording around so that the reason is first 🤔

className={classes.actionBtn}
disabled={true}
onClick={() => null}
disabled={database.status !== 'active'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm what about The database cluster must be active to add a new connection pool? Swap the wording around so that the reason is first 🤔

onClick={() => setIsAddPoolDrawerOpen(true)}
TooltipProps={{ placement: 'top' }}
tooltipText={
database.status !== 'active'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create a disabled variable so that the state is sync'd

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verification steps ✅

Comment on lines +40 to +59
/** Shared ErrorText component that displays formatted error messages below form field components that don't have the errorText property */
const SharedErrorText = (errorMessage: string | undefined) =>
errorMessage && (
<FormHelperText
error
role="alert"
sx={{ marginTop: theme.spacingFunction(4) }}
>
{errorMessage}
</FormHelperText>
);

/** Utility function to generate error styles for form field components that can't set them by default */
const makeErrorStyles = (errorMessage: string | undefined) => {
return errorMessage
? {
border: `1px solid ${theme.tokens.component.Select.Error.Border}`,
}
: undefined;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could consider moving these to the databases utilities file, especially if they may be used elsewhere for the feature

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 1 failing test on test run #11 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing854 Passing11 Skipped40m 30s

Details

Failing Tests
SpecTest
clone-linode.spec.tsCloud Manager Cypress Tests→clone linode » can clone a Linode from Linode details page

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/linodes/clone-linode.spec.ts"

return `${poolMode.charAt(0).toUpperCase()}${poolMode.slice(1)}`;
}}
/>
{SharedErrorText(fieldState.error?.message)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems ok but just curious - why you don't use rules there?

}
};

const { mode, database, username } = watch();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use useWatch over watch for performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DBaaS Relates to Database as a Service

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

5 participants